package cs.android.view;

import cs.android.viewbase.ActivityViewBase;

import static cs.java.lang.Lang.alert;
import static cs.java.lang.Lang.set;

import cs.android.ActivityView;
import cs.android.lang.ServerRequest;
import cs.java.event.Task;

public class RequestMessageToast extends ActivityViewBase {

	public RequestMessageToast(ActivityView parent) {
		super(parent);
	}

	private void onRequestDone(final ServerRequest request) {
		if (set(request.getMessageId())) alert(getString(request.getMessageId()));
	}

	public void setRequest(final ServerRequest request) {
		new Task(this, request.getOnDone(), "on_done") {
			public void run() {
				onRequestDone(request);
			}
		};
	}

}
